#include "debug.h"
#include "help.h"


/*
  *  Alert: should free buf when used
 */

static int log_fd;
static char* log_file;

void log_init(char* filename){
	log_file = strdup(filename);
	log_fd =  open(log_file, O_CREAT|O_RDWR);
	if(log_fd ==-1){
		debug_warn("open log file:%s failed! errno[%d]\n", filename, errno);	
	}
}
void  log_to_file(char* str, int size){
	int rc;
	rc = write(log_fd, str, size);
	check(rc);

}

